package com.jdbc.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.jdbc.dao.AccountXmlDao;

@Repository
public class AccountXmlDaoImpl implements AccountXmlDao {

	@Autowired
	public JdbcTemplate jdbcTemplate;
	/**
	 * 转出信息
	 * @param accountOut 转出账户
	 * @param money转出的金额
	 */
	@Override
	public void accountOut(String accountOut,int money){
		String sql = "update account set account_money=account_money-? where account_name=?";
		jdbcTemplate.update(sql, money,accountOut);
	}
	
	/**
	 * 转入信息
	 * @param accountInt 转入的账户
	 * @param money转入金额
	 */
	@Override
	public void accountIn(String accountIn,int money){
		String sql = "update account set account_money=account_money+? where account_name=?";
		jdbcTemplate.update(sql, money,accountIn);
	}
}
